package me.tonywang.quartz.service;

import com.baomidou.mybatisplus.service.IService;
import me.tonywang.quartz.entity.Crontask;
import org.quartz.JobExecutionContext;
import org.quartz.SchedulerException;
import org.quartz.SchedulerMetaData;

import java.text.ParseException;
import java.util.List;

/**
 * <p>
 * 定时任务信息表 服务类
 * </p>
 *
 * @author tony.wang
 * @since 2018-05-19
 */
public interface ICrontaskService extends IService<Crontask> {
    void saveJob(Crontask task) throws ParseException, SchedulerException;

    void updateJob(Crontask task) throws ParseException, SchedulerException;

    void triggerJob(Crontask task) throws SchedulerException;

    void triggerTempJob(Crontask task) throws SchedulerException;

    void triggerTempJob(Crontask task, int startupDelay) throws SchedulerException;

    void deleteJob(String jobName, String jobGroup) throws SchedulerException;

    void deleteJobsInGroup(String groupName) throws SchedulerException;

    void pauseJob(String jobName, String jobGroup) throws SchedulerException;

    void pauseJobsInGroup(String groupName) throws SchedulerException;

    void pauseAllJob() throws SchedulerException;

    void resumeJob(String jobName, String jobGroup) throws SchedulerException;

    void resumeJobsInGroup(String jobGroup) throws SchedulerException;

    void resumeAllJob() throws SchedulerException;

    SchedulerMetaData getMetaData() throws SchedulerException;

    List<JobExecutionContext> getCurrentlyExecutingJobs() throws SchedulerException;

    void checkJobConfig(Crontask task) throws ParseException;

}
